import Vue from 'vue'
export default {
    state:{
       avatar:{}
    },
    getters:{
        getquanxian(state){
            if(!state.quanxian){
               state.quanxian = JSON.parse(localStorage.getItem('limit'))
            }
            return state.quanxian
        },
        getavatar(state){
            return state.avatar
        }
        
    },
    mutations:{
        getquanxian(state,quanxian){
            if(!state.qianxian){
                Vue.set(state,'quanxian',quanxian);
            }else{
                state.qianxian = quanxian
            }
        },
        addavatar(state,avatar){
            if(!state.avatar){
                Vue.set(state,'avatar',avatar)
            }else{
                state.avatar = avatar
            }
        },
        changeavatar(state,changeavatar){
            state.avatar.zhaopian = changeavatar
        }
      
    },
    actions:{
        addquanxianAction({commit},lim){
            commit('getquanxian',lim);
        },
        //接受用户头像
        addavatar({commit},avatar){
            commit('addavatar',avatar)
        },
        changeavatar({commit},changavatar){
            commit('changeavatar',changavatar)
        }
        
    }

};